Micron Document




Python syntax and semantics
part 10/45 · 74.8 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
... al = al + ['x'] # a new list created and assigned to al means al is no more alias for alist
... print(al)
...
>>> my_func(alist)
['a', 'b', 'c', 'x']
>>> print(alist)
['a', 'b', 'c']

In Python, non-innermost-local and not-declared-global accessible names are all aliases.

Among dynamically-typed languages, Python is moderately type-checked. Implicit conversion is defined for numeric types (as well as booleans), so one may validly multiply a complex number by an integer (for instance) without explicit casting. However, there is no implicit conversion between, for example, numbers and strings; a string is an invalid argument to a mathematical function expecting a number.

Base types

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────